#ifndef GULL_APPLICATIONMANAGER_H
#define GULL_APPLICATIONMANAGER_H

#include "Singleton.h"
#include "GullApplication.h"

namespace gull{
	namespace core {
		
		
		class ApplicationManager: public Singleton<ApplicationManager> 
		{
			friend class Singleton<ApplicationManager>;
			friend class GullApplication;

		public:
			inline static const GullApplication* getCurrentApplication();
            inline static void applicationLoop();
			static GullApplication* s_currentApplication;
			
		protected:
			
		private:
			inline static void setActiveApplication(GullApplication* ga);
			void registerApplication(GullApplication* ga);
			ApplicationManager();
			~ApplicationManager();
			
		};

        void
        ApplicationManager::applicationLoop()
        {
            s_currentApplication->applicationOnLoad();
        }
        
		const GullApplication*
		ApplicationManager::getCurrentApplication()
		{
			return s_currentApplication;
		}
		
		void
		ApplicationManager::setActiveApplication(GullApplication* ga)
		{
			s_currentApplication = ga;
		}
		
	}
}

#endif